typing: improve CaptureQueriesContext and test decorators in django.t…#3233
Merged
sobolevn merged 8 commits intoJul 5, 2026
Merged
Conversation
UnknownPlatypus
requested changes
Mar 28, 2026
Contributor
Author
|
@UnknownPlatypus All CI checks are now passing . I've addressed both the concerns raised:
Could you please re-review when you get a chance? |
sobolevn
reviewed
Jul 5, 2026
| initial_queries: int | ||
| final_queries: int | None | ||
| def __init__(self, connection: BaseDatabaseWrapper) -> None: ... | ||
| @override |
Member
There was a problem hiding this comment.
I think that the right solution is to remove def __iter__ here. It just copies the base class.
Contributor
Author
There was a problem hiding this comment.
Hey @sobolevn, tried that but got a mypy
abstract attribute error. Fixed it by removing
the Iterable base class and keeping __iter__
without @override. Works now!
Contributor
Author
Thankyou for the guidance and thorough review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…est.utils
I have made things!
This PR improves Django type stubs by strengthening type hints and replacing private API usage, while keeping runtime behavior unchanged.
Changes:
1. Private API replacement:
2. Stronger callable typing:
These improvements preserve runtime behavior while enhancing IDE autocomplete and type safety.
Verification:
Successfully ran: python -m mypy.stubtest django.test.utils
Output: Success: no issues found in 1 module